Azure Maps Spatial Service (stable:2022-08-01)

2025/10/06 • 9 deleted methods

Spatial_GetGeofence (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Get Geofence` API is an HTTP `GET` request that retrieves the proximity of a coordinate to a geofence that has been uploaded to the Data registry. You upload a geofence or set of fences into an Azure Storage Account, then register it with your Azure Maps Account using the [Data registry](/rest/api/maps/data-registry/register-or-replace), for more information see [How to create data registry](/azure/azure-maps/how-to-create-data-registries). For more information on on the geofence data format, see [Geofencing GeoJSON data](/azure/azure-maps/geofence-geojson). To query the proximity of a coordinate, you supply the location of the object you are tracking as well as the ID for the fence or set of fences, and the response will contain information about the distance from the outer edge of the geofence. A negative value signifies that the coordinate is inside of the fence while a positive value means that it is outside of the fence. This API can be used for a variety of scenarios that include things like asset tracking, fleet management, or setting up alerts for moving objects. The API supports [integration with Event Grid](/azure/azure-maps/azure-maps-event-grid-integration). The isAsync parameter is used to enable integration with Event Grid (disabled by default). To test this API, you can upload the sample data from Post Geofence API examples (Request Body) using the Data registry service and replace the `{udid}` from the sample request below with the `udid` used to create the Data registry. For more information on the data registry service, see [How to create data registry](/azure/azure-maps/how-to-create-data-registries). ### Geofencing InnerError code In geofencing response error contract, `innererror` is an object containing service specific information about the error. `code` is a property in `innererror` which can map to a specific geofencing error type. The table belows shows the code mapping between all the known client error type to the corresponding geofencing error `message`. innererror.code | error.message ---------------------------- | -------------------------------------- NullDeviceId | Device Id should not be null. NullUdid | Udid should not be null. UdidWrongFormat| Udid should be acquired from user data ingestion API. InvalidUserTime| Usertime is invalid. InvalidSearchBuffer| Searchbuffer is invalid. InvalidSearchRange| The value range of searchbuffer should be from 0 to 500 meters. InvalidLatLon| Lat and/or lon parameters are invalid. InvalidIsAsyncValue| The IsAsync parameter is invalid. InvalidModeValue| The mode parameter invalid. InvalidJson| Geofencing data is not a valid json file. NotSupportedGeoJson| Geofencing data can't be read as a Feature or FeatureCollections. InvalidGeoJson| Geofencing data is invalid. NoUserDataWithAccountOrSubscription| Can't find user geofencing data with provided account-id and/or subscription-id. NoUserDataWithUdid| Can't find user geofencing data with provided udid.
Reference Link ¶

⚼ Request

GET:  /spatial/geofence/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
deviceId: string ,
udid: string ,
lat: number ,
lon: number ,
z: number ,
userTime: string ,
searchBuffer: number ,
isAsync: boolean ,
mode: string ,
}

⚐ Response (200)

{
$headers:
{
x-correlation-id: string ,
}
,
$schema:
{
geometries:
[
{
deviceId: string ,
udId: string ,
geometryId: string ,
distance: number ,
nearestLat: number ,
nearestLon: number ,
nearestZ: number ,
}
,
]
,
expiredGeofenceGeometryId:
[
string ,
]
,
invalidPeriodGeofenceGeometryId:
[
string ,
]
,
isEventPublished: boolean ,
}
,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}
Spatial_PostGeofence (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Post Geofence` API is an HTTP `POST` request that retrieveS the proximity of a coordinate to a provided geofence or set of fences. With `POST` requests, you do not have to upload the fence data in advance, instead you supply the location of the object you are tracking in query parameters as well as the fence or set of fences data in post request body. For more information on on the geofence data format, see [Geofencing GeoJSON data](/azure/azure-maps/geofence-geojson). The response will contain information about the distance from the outer edge of the geofence. A negative value signifies that the coordinate is inside of the fence while a positive value means that it is outside of the fence. This API can be used for a variety of scenarios that include things like asset tracking, fleet management, or setting up alerts for moving objects. The API supports [integration with Event Grid](/azure/azure-maps/azure-maps-event-grid-integration). The isAsync parameter is used to enable integration with Event Grid (disabled by default).
Reference Link ¶

⚼ Request

POST:  /spatial/geofence/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
deviceId: string ,
lat: number ,
lon: number ,
z: number ,
userTime: string ,
searchBuffer: number ,
isAsync: boolean ,
mode: string ,
searchGeofenceRequestBody: object ,
}

⚐ Response (200)

{
$headers:
{
x-correlation-id: string ,
}
,
$schema:
{
geometries:
[
{
deviceId: string ,
udId: string ,
geometryId: string ,
distance: number ,
nearestLat: number ,
nearestLon: number ,
nearestZ: number ,
}
,
]
,
expiredGeofenceGeometryId:
[
string ,
]
,
invalidPeriodGeofenceGeometryId:
[
string ,
]
,
isEventPublished: boolean ,
}
,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}
Spatial_PostBuffer (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Post Buffer` API is an HTTP `POST` request that returns a `FeatureCollection` where each feature is a buffer around the corresponding indexed feature of the input. The buffer could be either on the outside or the inside of the provided feature, depending on the distance provided in the input. There must be either one distance provided per Feature in the `FeatureCollection` input, or if only one distance is provided, then that distance is applied to every feature in the collection. The positive (or negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry with a circle of radius equal to the absolute value of the buffer distance. The buffer API always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty polygon. The input may contain a collection of Point, MultiPoint, Polygon, MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if provided.
Reference Link ¶

⚼ Request

POST:  /spatial/buffer/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
bufferRequestBody:
{
geometries: object ,
distances:
[
number ,
]
,
}
,
}

⚐ Response (200)

{
summary:
{
udid: string ,
information: string ,
}
,
result: object ,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}
Spatial_GetBuffer (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Get Buffer` API is an HTTP `GET` request that returns a `FeatureCollection` where each feature is a buffer around the corresponding indexed feature of the input. The buffer could be either on the outside or the inside of the provided Feature, depending on the distance provided in the input. There must be either one distance provided per Feature in the FeatureCollection input, or if only one distance is provided, then that distance is applied to every Feature in the collection. The positive (or negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry with a circle of radius equal to the absolute value of the buffer distance. The buffer API always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty polygon. The input features are provided by a GeoJSON file which is uploaded using the [Data registry API](/rest/api/maps/data-registry/register-or-replace) and referenced by a unique udid. The GeoJSON file may contain a collection of Point, MultiPoint, Polygon, MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if provided. To test this API, you can upload the sample data from [Post Buffer API](/rest/api/maps/spatial/postbuffer#examples) examples (Request Body without distances array) using the [Data registry](/rest/api/maps/data-registry/register-or-replace) service and replace the `{udid}` in the following [sample request](/rest/api/maps/spatial/getbuffer#examples) with the `udid` used when creating the data registry. For more information, see [How to create data registry](/azure/azure-maps/how-to-create-data-registries).
Reference Link ¶

⚼ Request

GET:  /spatial/buffer/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
udid: string ,
distances: string ,
}

⚐ Response (200)

{
summary:
{
udid: string ,
information: string ,
}
,
result: object ,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}
Spatial_PostClosestPoint (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Post Closest Point` API is an HTTP `POST` request that returns the closest point between a base point and a given set of target points. The set of target points is provided by user data in post request body. The user data may only contain a collection of Point geometry. MultiPoint or other geometries will be ignored if provided. The algorithm does not take into account routing or traffic. The maximum number of points accepted is 100,000. Information returned includes closest point latitude, longitude, and distance in meters from the closest point.
Reference Link ¶

⚼ Request

POST:  /spatial/closestPoint/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
lat: number ,
lon: number ,
numberOfClosestPoints: integer ,
closestPointRequestBody: object ,
}

⚐ Response (200)

{
summary:
{
sourcePoint:
{
lat: number ,
lon: number ,
}
,
udid: string ,
information: string ,
}
,
result:
[
{
distanceInMeters: number ,
position:
{
lat: number ,
lon: number ,
}
,
geometryId: string ,
}
,
]
,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}
Spatial_GetClosestPoint (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Get Closest Point` API is an HTTP `GET` request the closest point between a base point and a given set of points in the user uploaded data set identified by `udid`. The set of target points is provided by a GeoJSON file which is uploaded using the [Data registry](/rest/api/maps/data-registry/register-or-replace) service and referenced by a unique udid. The GeoJSON file may only contain a collection of Point geometry. MultiPoint or other geometries will be ignored if provided. The maximum number of points accepted is 100,000. The algorithm does not take into account routing or traffic. Information returned includes closest point latitude, longitude, and distance in meters from the closest point. To test this API, you can upload the sample data from [Post Closest Point API](/rest/api/maps/spatial/postclosestpoint#examples) examples (Request Body) using the [Data registry](/rest/api/maps/data-registry/register-or-replace) service and replace the `{udid}` from the [sample request below](/rest/api/maps/spatial/getclosestpoint#examples) with the `udid` used when creating the data registry. For more information, see [How to create data registry](/azure/azure-maps/how-to-create-data-registries).
Reference Link ¶

⚼ Request

GET:  /spatial/closestPoint/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
udid: string ,
lat: number ,
lon: number ,
numberOfClosestPoints: integer ,
}

⚐ Response (200)

{
summary:
{
sourcePoint:
{
lat: number ,
lon: number ,
}
,
udid: string ,
information: string ,
}
,
result:
[
{
distanceInMeters: number ,
position:
{
lat: number ,
lon: number ,
}
,
geometryId: string ,
}
,
]
,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}
Spatial_PostPointInPolygon (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Post Point In Polygon` API is an HTTP `POST` request that returns a boolean value indicating whether a point is inside a set of polygons. The user data may contain Polygon and MultiPolygon geometries, other geometries will be ignored if provided. If the point is inside or on the boundary of one of these polygons, the value returned is true. In all other cases, the value returned is false. When the point is inside multiple polygons, the result will give intersecting geometries section to show all valid geometries (referenced by geometryId) in user data. The maximum number of vertices accepted to form a Polygon is 10,000.
Reference Link ¶

⚼ Request

POST:  /spatial/pointInPolygon/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
lat: number ,
lon: number ,
pointInPolygonRequestBody: object ,
}

⚐ Response (200)

{
summary:
{
sourcePoint:
{
lat: number ,
lon: number ,
}
,
udid: string ,
information: string ,
}
,
result:
{
pointInPolygons: boolean ,
intersectingGeometries:
[
string ,
]
,
}
,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}
Spatial_GetPointInPolygon (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Get Point In Polygon` API is an HTTP `GET` request that returns a boolean value indicating whether a point is inside a set of polygons. The set of polygons is provided by a GeoJSON file which is uploaded using the [Data registry](/rest/api/maps/data-registry/register-or-replace) service and referenced by a unique udid. The GeoJSON file may contain Polygon and MultiPolygon geometries, other geometries will be ignored if provided. If the point is inside or on the boundary of one of these polygons, the value returned is true. In all other cases, the value returned is false. When the point is inside multiple polygons, the result will give intersecting geometries section to show all valid geometries(referenced by geometryId) in user data. The maximum number of vertices accepted to form a Polygon is 10,000. To test this API, you can upload the sample data from [Post Point In Polygon API](/rest/api/maps/spatial/postpointinpolygon#examples) examples (Request Body) using the [Data registry](/rest/api/maps/data-registry/register-or-replace) service and replace the `{udid}` from the [sample request below](/rest/api/maps/spatial/getpointinpolygon#examples) with the `udid` used when creating the data registry. For more information, see [How to create data registry](/azure/azure-maps/how-to-create-data-registries).
Reference Link ¶

⚼ Request

GET:  /spatial/pointInPolygon/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
udid: string ,
lat: number ,
lon: number ,
}

⚐ Response (200)

{
summary:
{
sourcePoint:
{
lat: number ,
lon: number ,
}
,
udid: string ,
information: string ,
}
,
result:
{
pointInPolygons: boolean ,
intersectingGeometries:
[
string ,
]
,
}
,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}
Spatial_GetGreatCircleDistance (removed)
Description > [!NOTE] > > **Azure Maps Spatial service retirement** > > The Azure Maps Spatial service is now deprecated and will be retired on 9/30/25. For more information, see [End of Life Announcement of Azure Maps Spatial](https://aka.ms/AzureMapsSpatialDeprecation). The `Get Great Circle Distance` API is an HTTP `GET` request that returns the great-circle or shortest distance between two points on the surface of a sphere, measured along the surface of the sphere. This differs from calculating a straight line through the sphere's interior. This method is helpful for estimating travel distances for airplanes by calculating the shortest distance between airports.
Reference Link ¶

⚼ Request

GET:  /spatial/greatCircleDistance/{format}
{
x-ms-client-id: string ,
api-version: string ,
format: string ,
query: string ,
}

⚐ Response (200)

{
summary:
{
sourcePoint:
{
lat: number ,
lon: number ,
}
,
targetPoint:
{
lat: number ,
lon: number ,
}
,
}
,
result:
{
distanceInMeters: number ,
}
,
}

⚐ Response (default)

{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
additionalInfo:
[
{
type: string ,
info: object ,
}
,
]
,
}
,
}